import yaml
from base_tools.my_logger import logger

def my_read_yaml(file_name, key_word=None):
    logger.info("读取测试数据，数据存储文件地址为：{}, 读取关键字：{}".format(file_name, key_word))
    with open(file_name, encoding="utf-8") as f:
        values = yaml.safe_load(f)
        if key_word:
            new_values = []
            for value in values:
                if key_word == value.get("key_word"):
                    new_values.append(value)
            return new_values
    return values


# print(my_read_yaml(r"C:\TT\习知\15\UIAotoTestDemo-15\case_data\mail_list_manager\org_case_datas.yaml", key_word="update_org"))